package service.impl;

import dao.AttendanceDao;
import dao.DepartmentDao;
import entity.Department;
import org.apache.ibatis.session.SqlSession;
import service.DepartmentService;
import util.MyBatisUtil;

import java.sql.SQLException;
import java.util.List;

public class DepartmentServiceImpl implements DepartmentService {
    SqlSession sqlSession = MyBatisUtil.createSqlSession();

    @Override
    public List<Department> getAllDepartments() throws SQLException {
        List<Department> list = sqlSession.getMapper(DepartmentDao.class).getAllDepartments();
        MyBatisUtil.closeSqlSession(sqlSession);
        return list;
    }
}
